package org.domain.sigepac.session;

import org.domain.sigepac.Entity.Voluntario;
import org.domain.sigepac.home.EntityHomeSupport;
import org.domain.sigepac.repository.RepositorioVoluntario;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.FlushModeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.international.StatusMessages;

@Name("voluntarioHome")
@Scope(ScopeType.CONVERSATION)
public class VoluntarioHome extends EntityHomeSupport<Voluntario> {

	private static final long serialVersionUID = 1624266645825051326L;

	@In
	private StatusMessages statusMessages;

	@In
	private RepositorioVoluntario repositorioVoluntario;


	public VoluntarioHome() {
		// TODO Auto-generated constructor stub
	}


	@Override
	protected Voluntario createInstance() {
		Voluntario voluntario=new Voluntario();
		return voluntario;
	}



	public void salvar(){

		if(isManaged()){
			update();
		}else{
			persist();
		}

		//Utils.entityManagerFlush();

	}

	@Begin(flushMode=FlushModeType.MANUAL,join=true)
	public void setIdVoluntario(Integer id) {
	    setId(id);

	 }

	public Integer getIdVoluntario() {
	    return (Integer) getId();
	  }

}
